/**
 * Copyright (C) T-Systems International, 2013-2014
 *
 * The copyright of the computer program herein is the property of
 * T-Systems International. The program may be used and/or copied
 * only with the written permission of T-Systems International or in
 * accordance with the terms and conditions stipulated in the
 * agreement/contract under which the program has been supplied.
 *
 * $Author$
 * $Date$
 * $Rev$
 */
package com.tsystems.migdb;

import com.tsystems.migdb.persistence.LineService;
import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import javax.annotation.concurrent.ThreadSafe;
import javax.transaction.Transactional;

@ThreadSafe
@DisallowConcurrentExecution
@Log4j2
public class LineProcessingJob implements Job {

    private final LineService service;

    public LineProcessingJob(@NonNull LineService service) {
        this.service = service;
    }

    @Transactional
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        log.debug("Processing lines");
        System.out.println(service.findAll());
    }

}